package com.songjiakang.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.songjiakang.entity.Home;
import com.songjiakang.entity.Mating;
import com.songjiakang.entity.Type;



public interface HomeDao {
	List<Home> list(Home home);
	@Delete("DELETE from home where id=#{id}")
	Boolean del(@Param("id")Integer id);
	@Update("UPDATE  home set `status`=1,rental_time=NULL  WHERE id=#{id}")
	void tui(@Param("id")Integer id);
	@Update("UPDATE  home set `status`=0,rental_time=now()  WHERE id=#{id}")
	void chu(Integer id);
	@Select("select * from type")
	List<Type> gettype();
	@Insert("insert into home set name=#{name},building=#{building},number=#{number},status=#{status},listing_time=#{listingTime},type_id=#{typeId}")
	void add(Home home);
	@Select("select * from home where id=#{id}")
	Home gethome(@Param("id")Integer id);
	@Select("select * from mating where name=#{shebei} and price=#{danjia}")
	Mating selectshebei(@Param("shebei")String shebei,@Param("danjia") Double danjia);
	@Insert("insert into mating set name=#{shebei} and price=#{danjia}")
	void addshebei(@Param("shebei")String shebei,@Param("danjia") Double danjia);
	@Insert("insert into limitt set r_id=#{id},s_id=#{integer},num=#{shuliang}")
	void update(@Param("id")Integer id,@Param("integer") Integer integer, @Param("shuliang")Integer shuliang);
	
	
	
}
